<template>
  <div class="brandInfo">
    <!-- 品牌详情 -->
    <div class="brandDetail">
      <!-- 广告 -->
      <div class="banner">
        <img :src="brandData.app_list_pic_url" alt="">
        <div class="name">{{brandData.name}}</div>
      </div>
      <!-- 描述 -->
      <div class="desc">{{brandData.simple_desc}}</div>
      <!-- 列表 -->
      <ul class="list" v-if="goodsList.length != 0">
        <li class="item" v-for='item in goodsList' :key='item.id'>
          <img :src="item.list_pic_url" alt="">
          <div class="name">{{item.name}}</div>
          <div class="price">￥{{item.retail_price}}</div>
        </li>
      </ul>
      <!-- 数据库暂无数据... -->
      <div class="none" v-else>
        数据库暂无数据...
      </div>
    </div>
  </div>

</template>

<script>
import { detailaction } from "@/api/home/brand";
export default {
  data() {
    return {
      brandData: [], // 品牌数据
      goodsList: [], // 商品列表
    };
  },
  // 计算
  computed: {},
  // 创建
  created() {
    // 首页品牌制造商直供的详情数据
    detailaction({
      id: this.$route.query.id,
    }).then((res) => {
      this.brandData = res.data.data;
      this.goodsList = res.data.goodsList;
    });
  },
  // 准备
  mounted() {},
  // 方法
  methods: {},
};
</script>

<style lang='scss' scoped>
.brandInfo {
  .brandDetail {
    // 广告
    .banner {
      width: 100%;
      height: 145px;
      position: relative;
      img {
        width: 100%;
        height: 100%;
      }
      .name {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 20px;
        color: #fff;
        border-bottom: 2.5px solid #fff;
        padding: 2.5px;
      }
    }
    // 描述
    .desc {
      font-size: 15px;
      color: #666;
      padding: 21px 16px;
      background-color: #fff;
    }
  }
  // 列表
  .list {
    background-color: #f4f4f4;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .item {
      list-style: none;
      width: calc(50% - 2px);
      background-color: #fff;
      margin-bottom: 2.5px;
      padding: 7.5px 0;
      img {
        width: 150px;
        height: 150px;
      }
      .name {
        padding: 0 10px;
        margin: 7.5px auto 11px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .price {
        font-size: 16px;
        color: #b4282d;
      }
    }
  }
  // 数据库暂无数据
  .none {
    color: #999;
    font-size: 16px;
    padding-top: 100px;
  }
}
</style>